<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>获取数字的绝对值</title>
</head>
<body>
    <script>
        function jdz (abs){
            if (abs<0){
                alert(abs+"的绝对值为："+(abs*-1));
            }else{
                alert(abs+"的绝对值为："+abs);
            }
        }
        jdz(-30);
    </script>
</body> 
</html>